{template '_header'}

<div class="page-header">
    当前位置：<span class="text-primary">{if !empty($level['id'])}编辑{else}添加{/if}平台{if !empty($item['id'])}({$item['name']}){/if}</span>
</div>

<div class="page-content">
    <div class="page-sub-toolbar">
        <span class=''>
            {ifp 'platform.edit'}
                <a class="btn btn-primary btn-sm" href="{php echo webUrl('platform/post')}">添加新平台</a>
            {/if}
        </span>
    </div>
<form id="setform"  {ifp 'platform.edit'}action="" method="post"{/if} class="form-horizontal form-validate">

<input type="hidden" name="id" value="{$item['platformid']}" />

        <div class="form-group">
            <label class="col-sm-2 control-label">排序</label>
            <div class="col-sm-8">
                {ifp 'platform.edit'}
                <input type="text" class="form-control" name="displayorder" value="{$item['displayorder']}" data-rule-required="true"/>
                {else}
                <div class="form-control-static">
                    {$item['displayorder']}
                </div>
                {/if}
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label must">平台名称</label>
            <div class="col-sm-8">
                {ifp 'platform.edit'}
                <input type="text" class="form-control" name="catename" value="{$item['name']}" data-rule-required="true"/>
                {else}
                <div class="form-control-static">
                    {$item['name']}
                </div>
                {/if}
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">对应的公众号</label>
            <div class="col-sm-8">
                {ifp 'platform.edit'}
                    <select name="uniacid" class="form-control">
                        <option value="0">选择公众号</option>
                        {loop $uni $row}
                        <option value="{$row['uniacid']}" {if $row['uniacid']==$item['uniacid']}selected{/if}>{$row['name']}</option>
                        {/loop}
                    </select>
                {else}
                <div class="form-control-static">
                    {loop $uni $row}
                    {if $row['uniacid']==$item['uniacid']}{$row['name']}{/if}
                    {/loop}
                </div>
                {/if}
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">平台logo</label>
            <div class="col-sm-8">
                {ifp 'platform.edit'}
                {php echo tpl_form_field_image('thumb',$item['thumb'],'../addons/ewei_shopv2/static/images/nopic.jpg')}
                {else}
                {if empty($item['thumb'])}
                <img src="../addons/ewei_shopv2/static/images/nopic.jpg" onerror="this.src='../addons/ewei_shopv2/static/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
                {else}
                <img src="{php echo tomedia($item['thumb'])}" onerror="this.src='../addons/ewei_shopv2/static/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
                {/if}
                {/if}
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">平台描述</label>
            <div class="col-sm-8">
                {ifp 'platform.edit'}
                <textarea name="description" class="form-control">{$item['description']}</textarea>
                {else}
                <div class="form-control-static">{$item['description']}</div>
                {/if}
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">显示状态</label>
            <div class="col-sm-8">
                {ifp 'platform.edit'}
                <label class="radio-inline">
                    <input type="radio" name="status" value="1" {if $item['status']==1}checked{/if} />是
                </label>
                <label class="radio-inline">
                    <input type="radio" name="status" value="0" {if $item['status']==0}checked{/if}/> 否
                </label>
                {else}
                <div class="form-control-static">
                    {if $item['status']==0}
                    否
                    {elseif $item['stauts']==1}
                    是
                    {/if}
                </div>
                {/if}
            </div>
        </div>

{ifp 'platform.edit'}
<div class="form-group">
    <label class="col-sm-2 control-label"></label>
    <div class="col-sm-9 col-xs-12">
        <input type="submit"  value="提交" class="btn btn-primary" />
    </div>
</div>
{/if}

</form>
</div>

{template '_footer'}